
class Packet:
    def __init__(self):
        self.m_data = ""
        self.m_header = None
    
    def data(self):
        return self.m_data
    
    def header(self):
        return self.m_header
    
    def pkt_data(self):
        if isinstance(self.m_data, Packet):
            return self.m_header + self.m_data.pkt_data()
        elif str == type(self.m_data):
            return self.m_header + self.m_data
        else:
            raise Exception("Invalid packet data type")
    
    def __len__(self):
        return len(self.pkt_data())
        
    def send(self, capture):
        capture.send(self.pkt_data())
            